package com.lm56.web;

import com.lm56.web.network.domain.Location;
import com.lm56.web.network.domain.ShippingType;
import com.lm56.web.network.domain.CompanyDTO;
import com.lm56.common.MyTextValuePair;
import com.lm56.web.CommonMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

/**
 * Created by Kelvin Yeung on 2016/10/26.
 */
@Component
@Transactional
public class CommonService {

    @Autowired
    CommonMapper commonMapper;

    public List<MyTextValuePair<Integer>> getLocationsKeyValueList(){
        return commonMapper.getLocationsKeyValueList();

    }

    public List<MyTextValuePair<Integer>> getLocationsKeyValueListByIds(List<Long> ids){
        return commonMapper.getLocationsKeyValueListByIds(ids);

    }
    /**
     * 位置信息
     * @return
     */
    public Location getLocationById(long locationId){
        return commonMapper.getLocationById(locationId);
    }
    /**
     * 运输方式
     * @return
     */
    public List<ShippingType> getShippingTypeList(){
        return commonMapper.getShippingTypeList();
    }



    /**
     * 运输方式
     */
    public ShippingType loadShippingTypeById(Long typeId){
        return  commonMapper.loadShippingTypeById(typeId);
    }
    /**
     * 货物数量的单位
     * @return
     */
    public List<MyTextValuePair<String>> getGoodsQtyUnit(){
        return commonMapper.getGoodsQtyUnit();
    }

    /**
     * 货物数量的单位
     * @return
     */
    public MyTextValuePair<String> getGoodsQtyUnitByUnitCode(String unitCode){
        return commonMapper.getGoodsQtyUnitByUnitCode(unitCode);
    }

    public List<CompanyDTO> getCompanyList(){
        return commonMapper.getCompanyList();
    }
}
